﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace converter.template.item
{
    public sealed class Variable
    {
        public Variable(string name, string typeName, bool required, object val)
        {
            this.name = name;
            this.typeName = typeName;
            this.required = required;
            this.val = val;
        }

        public string GetName()
        {
            return name;
        }

        //public TemplateVariable.VAR_TYPE GetVarType()
        //{
        //    switch (typeName.ToLower())
        //    {
        //        case "boolean":
        //            return TemplateVariable.VAR_TYPE.BOOLEAN;
        //        case "datetime":
        //            return TemplateVariable.VAR_TYPE.DATE;
        //        case "integer":
        //            return TemplateVariable.VAR_TYPE.INTEGER;
        //        case "float":
        //            return TemplateVariable.VAR_TYPE.FLOAT;
        //        case "string":
        //            return TemplateVariable.VAR_TYPE.TEXT;
        //        default:
        //            throw new ArgumentException(string.Format("Unkown variable type: {0}", typeName));
        //    }
        //}

        public bool IsRequired()
        {
            return required;
        }

        public object GetValue()
        {
            return val;
        }

        private readonly string name;
        private readonly string typeName;
        private readonly bool required;
        private readonly object val;
    }
}
